﻿using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ModelBinding.Binders;

namespace Lamp.Client.ApiGateway.Core
{
    public class GateWayModelBinderProvider : IModelBinderProvider
    {
        private readonly IModelBinder _modelBinder = new GateWayModelBinder(new SimpleTypeModelBinder(typeof(GateWayModel)));
        public IModelBinder GetBinder(ModelBinderProviderContext context)
        {
            return context.Metadata.ModelType == typeof(GateWayModel) ? _modelBinder : null;
        }
    }
}
